package com.rfid.a252robot.admin.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.rfid.a252robot.R;
import com.rfid.a252robot.admin.bean.Address;
import com.rfid.a252robot.base.BaseAdapter;

import java.util.List;

public class AddressAdapter extends BaseAdapter<AddressAdapter.MyHolder, Address> {


    public AddressAdapter(List<Address> data) {
        super(data);
    }

    @Override
    protected void bindView(MyHolder holder, int position) {
        Address address = mData.get(position);
        holder.textView.setText(address.getPointName());
    }

    @NonNull
    @Override
    public MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new MyHolder(LayoutInflater.from(parent.getContext()).inflate(getLayout(),parent,false));
    }

    protected int getLayout() {
        return R.layout.item_text_layout;
    }

    class MyHolder extends RecyclerView.ViewHolder {
        TextView textView;
        public MyHolder(@NonNull View itemView) {
            super(itemView);
            textView = itemView.findViewById(R.id.text);
        }
    }
}
